﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using danreng.Domain;
using sharp_net.Mvc;

namespace danreng.Host.Helper {
    public class AuthTicket {
        public static FormsAuthenticationTicket CreateTicket(UserData user) {
            var userTicket = new UserIdentity {
                Id = user.Id,
                Name = user.DisplayName,
                Email = user.Email
            };

            var ticket = new FormsAuthenticationTicket(1,
                user.DisplayName,
                DateTime.Now,
                DateTime.Now.Add(FormsAuthentication.Timeout),
                false,
                userTicket.ToString());

            return ticket;
        }
    }
}